var module = instance_create(0, 0, obj_Module);
assertInitialized("module", module);
var tile = instance_create(0, 0, obj_Tile);
assertInitialized("tile", tile);
setTile(7, 7, tile, module);
assertInitialized("moduleTile", module.tiles[7,7]);
show_debug_message("Module owns tile: " + string(ownsTile(tile, module)));
with(tile) 
{
    instance_destroy();
}
assertInitialized("moduleTile after destruction", module.tiles[7,7]);
unsetTile(7, 7, module);
assertInitialized("moduleTile after unsetting", module.tiles[7,7]);
with(module)
{
    instance_destroy();
}

show_debug_message("Module addition");
//module1 = 5x10 @ 5,4
var module1 = instance_create(0, 0, obj_Module);
//module2 = empty
var module2 = instance_create(0, 0, obj_Module);
for(iii = 0; iii < 5; iii++)
{
    for(jjj = 0; jjj < 10; jjj++)
    {
        var tile = 0;
        tile = instance_create(0, 0, obj_Tile);
        tile.sprite_index = iii + jjj;
        setTile(iii, jjj, tile, module1);
        with(tile)
        {
            instance_destroy();
        }
    }
}
module1.tileX = 5;
module1.tileY = 4;

show_debug_message("Changing module1's tileX effects module2's?");
assertEquals(module2.tileX, module1.tileX);

layerModule(module2, module1);

show_debug_message("Module 1 + Module 2 x size");
assertEquals(10, array_length_2d(module2.tiles, 0));

show_debug_message("Module 1 + Module 2 y size");
assertEquals(14, array_height_2d(module2.tiles));

assertInitialized("Bottom right corner", module2.tiles[13, 9]);

writeArray2D(module2.tiles);

show_debug_message("Module subtraction");
removeModule(module1, module2);

assertInitialized("Bottom right corner", module2.tiles[13, 9]);

writeArray2D(module2.tiles);

with(module1)
{
    instance_destroy();
}
with(module2)
{
    instance_destroy();
}